"""
Author: wenbin
Create: 2024-09-03
"""
import uuid

from sqlalchemy import Column, UUID, Index, Text, String

from .base_model import BaseModel
from ..enums import ConversationType


class Conversation(BaseModel):
    """会话模型"""

    __tablename__ = "conversation"
    __table_args__ = (
        Index("idx_conversation_app_id", "app_id"),
        Index("idx_conversation_account_id", "account_id"),
        {"comment": "会话表"}
    )

    id = Column(UUID, default=uuid.uuid4(), primary_key=True, comment="id")
    app_id = Column(UUID, nullable=False, comment="应用 id")
    account_id = Column(UUID, nullable=False, comment="账号 id")
    summary = Column(Text, nullable=False, comment="摘要")
    type = Column(String(20), nullable=False, default=ConversationType.NORMAL.value, comment="类型")
